<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
    <html>
      <body>
        <h2>User Details</h2>
        <table border="1">
          <tr bgcolor="#9acd32">
            <th>FirstName</th>
            <th>LastName</th>
            <th>Job</th>
            <th>Address</th>
            <th>Hobbies</th>
          </tr>
          <xsl:for-each select="users/user">
            <tr>
              <td>
                <xsl:value-of select="fname" />
              </td>
              <td>
                <xsl:value-of select="lname" />
              </td>
              <td>
                <xsl:value-of select="job" />
              </td>
              <td>
                <xsl:value-of select="address" />
              </td>
              <td>
               <xsl:for-each select="hobbies/hobby">
                        <xsl:value-of select="." />
                        <xsl:if test="position() != last()">
                            <xsl:text> , </xsl:text>
                        </xsl:if>
                    </xsl:for-each>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
